package eval.vm;

/**
 * This class compare between 2 VM minimum CPU:
 * return -1 when the first smaller than the second.
 * return 1 when the first bigger than the second.
 * return 0 when both VM's minimum CPU are equal. 
 * 
 * @author Amit Peled   <amit.kapina@gmail.com>
 * @author Igal Kaufman <igal.kaufman@gmail.com>
 */
import java.util.Comparator;

public class MinCPURequiredComparator implements Comparator<VirtualMachine> {

	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	@Override
	public int compare(VirtualMachine v1, VirtualMachine v2) {
		if (v1.getVMConfiguration().getMinCpu() < v2.getVMConfiguration()
				.getMinCpu())
			return -1;

		if (v1.getVMConfiguration().getMinCpu() > v2.getVMConfiguration()
				.getMinCpu())
			return 1;

		return 0;
	}

}
